import {createRouter, createWebHistory, RouteRecordRaw} from "vue-router";
import {HomeOutlined,LaptopOutlined,DatabaseOutlined,UsergroupAddOutlined,CommentOutlined,NotificationOutlined,SafetyCertificateOutlined,UserOutlined} from "@ant-design/icons-vue";

// 2. 配置路由
const routes: Array<RouteRecordRaw> = [
    {
        path:"/",
        redirect:"home",
        component:()=>import("../pages/index/index.vue"),
        children:[
            {
                path:"home",
                name:"home",
                meta:{icon:HomeOutlined,name:"主页"},
                component:()=>import("../pages/index/home/index.vue")
            },
            {
                path:"diagnose",
                name:"diagnose",
                meta:{icon:LaptopOutlined,name:"诊断报告"},
                component:()=>import("../pages/index/diagnose/index.vue")
            },
            {
                path:"patience",
                name:"patience",
                meta:{icon:DatabaseOutlined,name:"病例追踪"},
                component:()=>import("../pages/index/patience/index.vue")
            },
            // {
            //     path:"huizhen",
            //     name:"huizhen",
            //     meta:{icon:UsergroupAddOutlined,name:"会诊"},
            //     children:[
            //         {   path:"apply",
            //             name:"apply",
            //             meta:{name:"申请"},
            //             component:()=>import("../pages/index/huizhen/apply/index.vue")
            //         },
            //         {   path:"discussing",
            //             name:"discussing",
            //             meta:{name:"远程会诊"},
            //             component:()=>import("../pages/index/huizhen/discussing/index.vue")
            //         }
            //     ]
            // },
            {
                path:"answer",
                name:"answer",
                meta:{icon:CommentOutlined,name:"答疑"},
                component:()=>import("../pages/index/answer/index.vue")
            },
            // {
            //     path:"notice",
            //     name:"notice",
            //     meta:{icon:NotificationOutlined,name:"消息通知"},
            //     component:()=>import("../pages/index/notice/index.vue")
            // },
            {
                path:"control",
                name:"control",
                meta:{icon:SafetyCertificateOutlined,name:"质量控制"},
                children:[
                    {   path:"rate",
                        name:"rate",
                        meta:{name:"传染病"},
                        component:()=>import("../pages/index/control/rate/index.vue")
                    },
                    {
                        path:"hazard",
                        name:"hazard",
                        meta:{name:"危急值"},
                        component:()=>import("../pages/index/control/hazard/index.vue")
                    }
                ]
            },
            {
                path:"personal",
                name:"personal",
                meta:{icon:UserOutlined,name:"个人信息"},
                component:()=>import("../pages/index/personal/index.vue")
            }
        ]
    },
    {
      path:"/login",
      name:"登陆",
      component:()=>import("../pages/login/Login.vue")
    },


];
// 1.返回一个 router 实列，为函数，里面有配置项（对象） history
const router = createRouter({
    history: createWebHistory(),
    routes,
});
// router.beforeEach((to, from,next)=>{
//
// })

// 3导出路由   然后去 main.ts 注册 router.ts
export default router